<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .active {
        color: red;
    }
</style>
<body>
    <script src="./js/vue.js"></script>
    <div id='app'>
       <ul>
            <li :class="{active:currentIndex===index}" v-for="(item,index) in movies" @click="liClick(index)">{{item}}</li>
       </ul>
    </div>
    
    <script>
        let app =new Vue({
             el:"#app",
             data:{
                movies:["死亡笔记","飞驰人生","星际穿越","奥特曼","太空漫游"],
                currentIndex:''
             },
             methods: {
                liClick(index) {
                    this.currentIndex=index
                }
             }
        })
    </script>
</body>
</html>